﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Criterion;
using Nissen_Model;

namespace Nissen_Dao
{
	public class MachineDao : DaoBase
	{
		public IList<Machine> GetMachineByName(string matchineName)
		{
			using (ISession session = this.SessionFactory.OpenSession())
			{
				ICriteria crt = session.CreateCriteria<Machine>();

				crt.Add(Restrictions.Eq("MachineName", matchineName));

				return crt.List<Machine>(); 
				
			}
			
		}

		public void SaveOrUpdate(Machine machine)
		{
			using (ISession session = this.SessionFactory.OpenSession())
			{
				session.SaveOrUpdate(machine);
			}
		}

	}
}
